-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support to check if an attribute is present or not without having to get the value #3957
Conversation
…ing to get the value.
@zhiics @vinx13 @anijain2305 Can you please review? |
python/tvm/relay/frontend/common.py
Outdated
@@ -41,6 +41,20 @@ class StrAttrsDict(object): | |||
def __init__(self, attrs): | |||
self.attrs = attrs | |||
|
|||
def is_attr_present(self, key): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's think about the name, shall we just name it has_attr
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a problem with has_attr
. i can submit a change with that name.
@vinx13 can you take a look at it now. |
…ing to get the value (apache#3957) * Adding support to check if an attribute is present or not without having to get the value. * - Renaming the method to more appropriate name.
…ing to get the value (apache#3957) * Adding support to check if an attribute is present or not without having to get the value. * - Renaming the method to more appropriate name.
…ing to get the value (apache#3957) * Adding support to check if an attribute is present or not without having to get the value. * - Renaming the method to more appropriate name.
There is a requirement in the parsing of pre-quantized mxnet model where; an attribute's value depends on another attribute being present or absent. The example can be found here
Since there is no way for querying if an attribute is present or not in a very clean way possible I am adding a new method to check if an attribute is present.
Since the attribute in question is a float passing in a NAN or something equivalent is not right since i NAN could be a legal value of something gone wrong during quantization.
Another way could be to pass a String instead as a default value, but that will not be a clean solution since we have a api which is supposed to return a float is returning a string instead.